import request from '@/utils/request'

// 获取经纪列表
export function getAgentsList(paging) {
  return request.get('/agents' + `?name_contains=${paging.name}`)
}

// 跳页
export function getAgentsPage(paging) {
  // 跳页公式start=page-1*limit
  return request.get('/agents' + `?_limit=${paging.limit}&_start=${(paging.page - 1) * paging.limit}&name_contains=${paging.name}`)
}

// 新增经纪
export function addAgents(data) {
  return request.post('/agents', data)
}

// 删除经纪
export function delAgent(id) {
  return request.delete('/agents/' + id)
}

// 获取指定经纪
export function getAgentById(id) {
  return request.get('/agents/' + id)
}

// 编辑经纪
export function uploadAgent(data) {
  return request.put('/agents/' + data.id, data)
}
